Lab Setup
Verify prerequisites
Configure your local Maven environment
Compile the lab assets project
Download and install Red Hat® JBoss® Developer Studio and the Integration Stack plug-in
Import the project in JBoss Developer Studio
Create your Red Hat® JBoss® Fuse app using the OpenShift Enterprise by Red Hat® gear
Access the JBoss Fuse Management Console
Use SSH to connect to your online lab account
Tail your application log files
Access to the Internet
Access to your course confirmation email
Experience with Java, Apache Maven, and SSH
1. Install Required Software on Your Machine
| Software | Version & URL | Notes | |
|---|---|---|---|
Java SE | Required | ||
Apache Maven | Required | ||
JBoss Developer Studio | Required. Account on the jboss.org web site is needed. | ||
Integration Stack | Required. Account on the jboss.org web site is needed. | ||
SoapUI | Optional |
2. Install the Exercises
The lab exercises and their solutions are available in the following zip archives:
If you have not already done so, install the exercises by unzipping this archive to a location on your file system.
You will then find all the Camel exercises stored in the camel-labs-VERSION-NUMBER-exercise and camel-labs-VERSION-NUMBER-solution folders.
On Windows machines, it is recommended that you designate either C:\ or C:\dev as the destination folder when unzipping the files to provide easy file access. |
3. Configure Your Local Maven Environment
All the labs for this course involve using Apache Maven modules with dependencies on Maven libraries supported in JBoss Fuse. Red Hat provides both online and offline Maven repositories for JBoss Fuse. Follow these steps to configure these online repositories on your machine:
To get started, edit the Apache Maven
settings.xmlfile located under the directoryhome_directory/.m2 or ~/.m2.If this file does not exist under this location, you can also edit the same file which is available under the confsubdirectory of the Apache Maven installation directory.Replace the contents of the
settings.xmlwith the contents ofcamel-labs-VERSION-NUMBER-exercise/feature-exercises/settings.xmlWithin the
<profile>tags in thesettings.xmlare defined theJBoss Fuserepositories that you need to build the code during execution ofmvn compileormvn installcommands.Within the
<activeProfile>tags in thesettings.xmlis the name of the default profile used when Apache Maven is running.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<!-- Profile with online repositories required by Fuse -->
<profile>
<id>fuse-online-repos</id>
<repositories>
<repository>
<id>jboss-ga-repository</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jboss-public-repository</id>
<url>http://repository.jboss.org/nexus/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-ga-plugin-repository</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>jboss-public-plugin-repository</id>
<url>http://repository.jboss.org/nexus/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!-- Activation of the Fuse profile -->
<activeProfile>fuse-online-repos</activeProfile>
</activeProfiles>
</settings>4. Compile the Lab Assets
To verify that Apache Maven is working correctly on your machine, you are going to compile the code for the Apache Camel labs.
Open a Linux/Unix/MS-DOS terminal and change to
camel-labs-VERSION-NUMBER-solutiondirectory.Execute the
mvn compilecommand to compile the code.If the compilation process succeeds, you will see the following BUILD SUCCESS message (at the end of a long list of trace results) on the console. If you see an error message instead, respond to the error reported.
[INFO] Copying 1 resource [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] RedHat GPE Training :: Camel Project Exercise ..... SUCCESS [0.002s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Standalone SUCCESS [0.948s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Spring Standalaone SUCCESS [0.123s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Expressions SUCCESS [0.121s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Unit test SUCCESS [0.016s] [INFO] RedHat GPE Training :: Camel :: Exercise :: DataFormat SUCCESS [0.103s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Exceptions SUCCESS [0.083s] [INFO] RedHat GPE Training :: Camel :: Exercise :: CBR ... SUCCESS [2.523s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Web ... SUCCESS [0.126s] [INFO] RedHat GPE Training :: Camel :: Exercise :: WebService SUCCESS [17.661s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Aggregator SUCCESS [0.107s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Splitter SUCCESS [0.096s] [INFO] RedHat GPE Training :: Camel :: Exercise :: JMS Transactional Route SUCCESS [1.202s] [INFO] RedHat GPE Training :: Camel :: Exercise :: JDBC - JMS Transaction SUCCESS [0.214s] [INFO] RedHat GPE Training :: Camel :: Exercise :: Features file SUCCESS [0.404s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 24.551s [INFO] Finished at: Thu Oct 09 15:06:50 CEST 2014 [INFO] Final Memory: 55M/442M [INFO] ------------------------------------------------------------------------
5. JBoss Developer Studio
JBoss Developer Studio is an integrated development environment (IDE) that combines both tooling and runtime components including Eclipse plug-ins, best-of-breed open source tools, and the Red Hat® JBoss® Enterprise Application Platform (JBoss EAP).
For all the lab exercises, you must have JBoss Developer Studio installed in your local development environment. You will use JBoss Developer Studio to design Apache Camel Routes and to manage your remote lab applications which are enabled by OpenShift Enterprise (via SSH and the OpenShift Explorer view).
You can download JBoss Developer Studio from the jboss.org web site and the install guide is available from the RedHat Customer Portal.
JBoss Developer Studio includes a variety of Eclipse plug-ins. The following is a list of the JBoss Developer Studio plug-ins that you need to complete the labs in the middleware courses sponsored by Red Hat OPEN:
The Integration Stack Suite of plug-ins is of particular importance for use with JBoss Fuse and Red Hat® JBoss® A-MQ middleware. The Integration Stack is not included out-of-the-box with JBoss Developer Studio. You must manually install the suite by following the instructions in the IntegrationStack documentation.
JBoss Developer Studio includes an out-of-the-box plug-in for management of OpenShift Enterprise environments. No additional installation is required to use this plug-in. With this OpenShift Enterprise plug-in, you can fully manage your remote OpenShift Enterprise environment (ie; upload SSH keys, manage domains and apps, etc.).
JBoss Developer Studio includes an out-of-the-box plug-in for creating SSH / SCP connections to remote SSH-enabled servers. No additional installation is required to use this plug-in.
JBoss Developer Studio includes the eGit plug-in, which provides Git project support. No additional installation is required to use this plug-in. Git is an open source version control system, providing developers with fast, versatile access to the entire revision history of the application code that they are working on.
JBoss Developer Studio includes the m2e plug-in, which provides support for Apache Maven projects. No additional installation is required to use this plug-in. The m2e plug-in enables you to edit a Maven project’s pom.xml file and to run a Maven build from the IDE.
6. Import the Project in JBoss Developer Studio
Now that JBoss Developer Studio is installed, you are ready to import the camel-labs-VERSION-NUMBER-excercise Apache Maven project as follows:
Open JBoss Developer Studio.
Import the
camel-labs-VERSION-NUMBER-excerciseApache Maven project into a new workspace:Select File → Import from the menu.
Select Maven → Existing Maven Projects.
Figure 1. Importlab- part 1Click Next.
Click Browse and enter
$FUSE_LAB_HOME/lab2.Make sure the pom.xml box is checked for:
com.redhat.gpe.training.camel.Figure 2. Importlab- part 2Click Finish.
Confirm that the project imported correctly and that you can compile it using Maven by selecting Run as → maven install from the
pom.xmlfile of the parent Camel project.Figure 3. Run AsIf the process succeeds, you will see the BUILD SUCCESS message in the console.
Figure 4. Compilation result
7. Create a JBoss Fuse Application in OpenShift Enterprise
OpenShift Enterprise is a private Platform-as-a-Service (PaaS) that provides developers and IT organizations with an auto-scaling cloud application platform for deploying new applications on secure scalable resources with minimal configuration and management overhead. It supports a wide selection of programming languages and frameworks, such as Java, Ruby, and PHP. JBoss Developer Studio completes the application life cycle by providing tooling support.
You will use OpenShift Enterprise as a platform for hosting your JBoss Fuse Application during this training. The procedure is described in the GPE Common labs, and you will use OpenShift Explorer in JBoss Developer Studio to reach this goal.
Follow the steps defined here until you reach the Cartridges and Gear Type selection step.
Instead of selecting the JBoss EAP 6 cartridge, select the
JBoss Fuse 6.1.0 EAcartridge as shown here:Figure 5. JBoss Fuse cartridgeSave the passwords generated for the JBoss Fuse application; you will need this password to access the web-based JBoss Fuse Management Console.
| This password appears only when the gear is created and you cannot retrieve it unless you connect to OpenShift Enterprise using SSH protocol. |
You should now have a demo application that was provisioned using a JBoss Fuse cartridge on OpenShift Enterprise.
8. Access the JBoss Fuse Management Console
Next you will use a browser to access the JBoss Fuse Management Console, create a new container, and then install a Camel Twitter project in your new container.
8.1. Access Application Details
Expand the OpenShift connection (http://broker00.ose.opentlc.com) to display the domain (fuse.apps.ose.opentlc.com) and the
demoapplication you created.Right-click the
demoapplication icon and select Details.Figure 8. OpenShift application nameCopy the console URL and paste it in your browser.
Figure 9. Name of the JBoss Fuse Management ConsoleProvide your username (admin) and password that you captured while creating the OpenShift application (see Figure 6. Passwords generated)
Figure 10. Login screenAfter you connect to the JBoss Fuse Management Console, you are redirected to the menu, which contains options for navigating between the containers created, the application performance dashboard, the Fabric8 health monitor, and the Fabric8 wiki.
The console includes documentation about the various menu options. To access the documentation, click the Help icon () in the main navigation bar.
Figure 11. JBoss Fuse Management Console Menu
Next, to familiarize you with JBoss Fuse Middleware technology, you will now do the following:
Create a new JBoss Fuse instance (which is a Java OSGi Container)
Deploy a simple Camel Twitter project into this newly created container
8.2. Create a New JBoss Fuse Instance
From the JBoss Fuse Management Console, click the Runtime menu.
Click Create (on the right side of the screen).
Figure 12. Create a containerBefore you create the new container, you must authenticate yourself with the OpenShift Enterprise Server by providing the OpenShift Login ID at the Create New Container screen:
Ensure that the Container Type is set to openshift; this creates the contain in OpenShift Enterprise instead of on your local machine.
Figure 13. OpenShift LoginEnter your OpenShift Password and click Login to OpenShift. After login succeeds, you the OpenShift Domain field is populated with a domain name. You can now create a new container.
Figure 14. OpenShift PasswordSelect the gear profile fuse_medium from the pop-up list and enter
demo1in the Container Name field.Click Create and start container.
Figure 15. Container Demo1
After a few moments, a new container appears in the JBoss Fuse Management Console under the Runtime/Containers submenu. This newly created container is a JBoss Fuse OSGi container, which is managed in the JBoss Fuse cartridge in OpenShift Enterprise. This mechanism is covered in detail in the Fabric module of this course.
Now you are ready to deploy the Camel Twitter application into your new container.
8.3. Deploy the Camel Twitter Application
Click the
demo1container to select it.Figure 17. Select ContainerOn the Status tab, confirm the following information about your container:
Server Status = Running
Provision Status = success
On the Settings tab, note the following values: Local IP, Local Hostname* and Public Hostname.
Figure 18. Container statusUnder Associated Profiles, click Add to deploy the Camel Twitter Application to your container. A directory tree appears in a pop-up window, where you can filter the applications that you want to deploy (referred to as Fabric profiles).
Figure 19. Profile listEnter twitter in the Filter field and observe that the tree reduces to one branch: Example / Camel → Twitter
Check the twitter box and then click Add.
Figure 20. Profile Camel TwitterWhen you add a profile or an application within a container, JBoss Fuse Fabric provisions and deploys some predefined Java libraries (e.g. camel, camel-twitter) as well as the application code.
Because the twitterservice is an Apache Camel application, a Camel icon appears next tocamel.xmlin the container contents list on the left side of the JBoss Fuse Management Console.Figure 21. Container Camel ServiceConfirm that your Camel Twitter Application is working correctly:
Open the
demo1container by clicking Open in upper-right corner of the screen. image::images/instruction/container_buttons.png[].A new browser window opens. If an Authentication Required message appears, enter admin as the User Name and the password provided by OpenShift earlier (when you created the
democontainer) and then click Log In.Figure 22. Screen loginThe JBoss Fuse Management Console of the managed container
demo1is displayed:
Discover what the Camel Twitter application is currently doing by using the Camel and Logs menu options:
From the Camel menu, select the twitter-demo route (Camel Contexts → camel-example-twitter → Routes), and then click Diagram.
Figure 23. Camel RouteThe Apache Camel Route connects to the twitter.com server every 10ms to search for tweets containing the word Camel. Every time a result is found, it is sent to the log of the
demo1container.View the tweets received by clicking the Logs tab of the menu bar.
Filter the results by entering ‘twitter-demo’ in the Filter logs… field.
Wait for the screen to refresh. You should see the tweets received.
Figure 24. Tweets receivedClose this browser window when you are done viewing the tweets.
Delete the
demo1container; you will not use it in the next modules.Select the
demo1container under Runtime → Containers.Click Stop.
Click Delete.
Figure 25. Delete ContainerWhen prompted to confirm deletion, click Yes, delete, and then close the window within your browser.
Figure 26. Deletion confirmation
| This lab serves as a technology overview, and does not aim to cover all key concepts regarding JBoss Fuse. Much of what you learned in this introductory lab is directly applicable for tasks in the Modularity and Fabric labs. The OpenShift Enterprise Git project (typically included as part of an OpenShift application) is never used in this lab. |
9. SSH into Your Online Lab Account
Your lab instructions include steps that require you to access your OpenShift gear via SSH. If you want to connect to the remote gear directly, the instructions are described here.
10. Tail Your Application Log Files
While completing the labs in this training, you will be asked to tail one or more application log files using the OpenShift plug-in of JBoss Developer Studio.
In the OpenShift Explorer panel of JBoss Developer Studio, right-click your remote application.
From the drop-down list, select Tail files. . In the dialog box that appears, enter
-f -n 100 /logs/in the Tail options text box.Click Finish.
A new Console panel appears in JBoss Developer Studio that shows the various log files of your remote OpenShift application.